import { Injectable } from '@angular/core';
import axios from 'axios';


@Injectable({
  providedIn: 'root'
})
export class UserService {
  public user

  constructor() { }

  public getCurrentUser(){
    let baseUrl = "http://localhost:8999";

     axios.get(baseUrl+'/user/getCurrentUser', {withCredentials: true}).then(res=>{
      this.user = res.data;
      console.log("UserService")
      return this.user;
      }).catch((err)=>{
        console.log(err);
     }).finally(()=>{
        console.log('执行完了');
     });


  }

}
